package oj;


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;

/**
 * @author Liangyaoyun
 */
public class myQueue {
    /*    public static void main(String[] args) {
            Scanner cin = new Scanner(System.in);
            Queue<Integer>queue=new LinkedList<>();
            while(cin.hasNextInt())//重点在这里，此处命名为语句@1.
            {
                int t=cin.nextInt();
                for (int i = 0; i < t; i++) {
                    queue.add(cin.nextInt());
                }
                while (queue.size()-1!=0){
                    System.out.print(queue.poll()+" ");
                }
                System.out.println(queue.poll());
            }
        }*/
    /*B*/
/*    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            String a=scanner.nextLine();
            Stack<Character>stacka=new Stack<Character>();
            char[] charArray=a.toCharArray();
            int i=0;
            while (charArray[i]!='&'){
                stacka.push(charArray[i]);
                i++;
            }
            boolean flag=true;
            for (int j = i+1; j < charArray.length ; j++) {
                if (!stacka.isEmpty()&&stacka.pop().equals(charArray[j])){
                    flag=true;
                }else {
                    flag=false;
                }
            }
            if (flag){
                System.out.println("YES");
            }
            else {
                System.out.println("NO");
            }
        }
    }*/
    /*B*/
   /* public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            String a=scanner.nextLine();
            Stack<Character>stack=new Stack<Character>();
            Queue<Character>queue=new LinkedList<>();
            char[] charArray=a.toCharArray();
            boolean flag=true;
            int i=0;
            while (charArray[i]!='&'){
                queue.add(charArray[i]);
                i++;
            }
            while (i!=charArray.length){
                stack.push(charArray[i]);
                i++;
            }
            while (!queue.isEmpty()&&!stack.isEmpty()){
                if (queue.poll().equals(stack.pop())){
                }else {
                    flag=false;
                }
            }
            if (flag){
                System.out.println("YES");
            }else {
                System.out.println("NO");
            }
        }
    }*/
    /*C*/

 /*   public static boolean compare(char a, char b) {
        if (a == '+' && b == '+' || b == '-' || a == '-' && b == '+') {
            return true;
        } else if (a == '/' && b == '/' || b == '*' || a == '*' && b == '/') {
            return true;
        } else if (a == '*' || a == '/' && b == '+') {
            return true;
        }
        return false;
    }*/

    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String str = cin.nextLine();
        char[] charArray = str.toCharArray();
        Stack<Character> stack = new Stack<>();
        List<Character> list = new ArrayList<>();
        for (char s : charArray) {
            /*是左括号直接入栈*/
            if (s == '(') {
                stack.push(s);
            } else if (s == ')') {
                while (stack.peek() != '(') {
                    list.add(stack.pop());
                }
                /*循环结束，将左括号弹出*/
                stack.pop();
            }
            /*如果栈里为空或者栈里只有一个左括号，这样‘+’跟‘-’才成入栈*/
            else if (s == '-' || s == '+' ) {
                /*如果栈不为空，则说明栈里有元素*/
                if (!stack.isEmpty()) {
                    /*如果栈里的元素是‘(’才能入栈*/
                    if (stack.peek()=='('){
                        stack.push(s);
                    }/*同优先级弹栈入结果集*/
                    else {
                        list.add(stack.pop());
                        stack.push(s);
                    }
                }
                /*没进非空栈，则说明栈里无元素，直接入栈*/
                else {
                    stack.push(s);
                }
            }
            /*只有栈顶为‘+’或者'-'或者'('或者空栈时,'*'跟'/'才能入栈*/
            else if (s=='*'||s=='/'){
                /*如果栈不为空，则说明有元素*/
                if (!stack.isEmpty()){
                    /*只有栈顶为'+'或者'-'或者‘(’才能入栈*/
                    if (stack.peek()=='+'||stack.peek()=='-'||stack.peek()=='('){
                        stack.push(s);
                    }
                    /*同级或者低级弹栈入结果集*/
                    else {
                        list.add(stack.pop());
                    }
                }
                /*空栈，直接入栈*/
                else {
                    stack.push(s);
                }
            }
            /*字符直接入结果集*/
            else {
                list.add(s);
            }
        }

        //遍历结束，将符号栈剩余的符号依次取出放入集合中
        while (!stack.isEmpty()) {
            list.add(stack.pop());
        }
        for (char c :
                list) {
            System.out.print(c);
        }
    }
}


